//
//  CommitSuggestViewController.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/3/8.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "CommitSuggestViewController.h"

@interface CommitSuggestViewController ()<UITextViewDelegate>
@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UITextView *textView;
@property (strong, nonatomic) IBOutlet UITextField *phoneField;
@property (strong, nonatomic) IBOutlet UIButton *commitButton;
@property (strong, nonatomic) IBOutlet UIScrollView *scroview;
@property (strong, nonatomic) IBOutlet UILabel *placeLabel;

@end

@implementation CommitSuggestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViewLayout];
    // Do any additional setup after loading the view.
}

- (void)initViewLayout{
    
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.scroview];
    _scroview.contentSize = flexibleSize(CGSizeMake(0, 504.5), YES);
    _commitButton.layer.cornerRadius = 17*VerticalRatio();
    [_commitButton.layer masksToBounds];
    _textView.delegate = self;
}
- (IBAction)back:(id)sender {
    [self.navigationController  popViewControllerAnimated:YES];
}
- (IBAction)commitComment:(id)sender {
    
    NSMutableDictionary  *dic=[NSMutableDictionary dictionary];
    [dic setObject:_textView.text forKey:@"mfeeCon"];
    [dic setObject:_phoneField.text forKey:@"mfeeContact"];
    [dic setObject:@"2" forKey:@"mffeSource"];
    self.shareApi.delegate=self;
    [self.shareApi  requestOperationWithDic:dic withPath:SX_insertAppMallFeedback withHttpType:@"POST" withTag:SX_SX_insertAppMallFeedback];

}

- (void)textViewDidChange:(UITextView *)textView{
    if (textView  == _textView ) {
        if (_textView.text.length>0) {
            _placeLabel.hidden = YES;
        }else{
            _placeLabel.hidden = NO;
        }
    }
}

#pragma   mark---- GetADBanner Request Delegate

-(void)fetchDatabaseFinished:(NSMutableDictionary *)database withTag:(NSInteger)tag{
    if (tag == SX_SX_insertAppMallFeedback){
        if (  [[database valueForKey:@"type"] integerValue]!=1 ) {
            
            [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:1.5];
        }else  {
              [[CWHUDTips sharedInstance]  showTips:[database valueForKey:@"msg"]  withStatus:1 dismissAfter:2];
            [self.navigationController  popViewControllerAnimated:YES];
        }
    }
}
-(void)fetchDatabaseFailed:(NSError *)error message:(NSString *)message{
    
[self dismissWaitDialog];
    
}

        
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
